<template>
  <div id="publish">
    <h3>信息发布平台</h3>
    <ul>
      <li v-for="topic of topicList">
        <p>{{topic.content}}</p>
        <p>发布人： {{topic.authorName}}</p>
        <p>回复:</p>
        <ul>
          <li v-for="reply of topic.replyList">{{reply.userName}}： {{reply.content}}</li>
        </ul>
        <p>标签：</p>
        <ul>
          <li class="tag" v-for="tag of topic.tagList">{{tag.tag}}</li>
        </ul>
      </li>
    </ul>
  </div>
</template>

<script>
  export default {
    name: "TopicList",
    data () {
      return {
        topicList: []
      }
    },
    created () {
      this.$http
        .get("http://localhost:8080/publish/topic/list")
        .then((response) => {
          this.topicList = response.data
        })
    }
  }
</script>

<style scoped>
  #publish {
    background-color: #b8f8ff;
    max-width: 800px;
  }
  ul {
    width: 500px;
    min-height: 30px;
    align-items: left;
    text-align: left;
  }
  .tag {
    float: left;
    margin: 0 30px;
    min-height: 30px;
  }
</style>
